package com.gopay.common.cps.service.cbrmb.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.gopay.common.cps.dao.cbrmb.CbRmbRetranmissRecordDAO;
import com.gopay.common.cps.service.cbrmb.CbRmbRetranmissRecordService;
import com.gopay.common.domain.cbrmb.CbRmbRetranmissRecord;

@Service
public class CbRmbRetranmissRecordServiceImpl implements CbRmbRetranmissRecordService {
	
	@Resource(name = "cbRmbRetranmissRecordDAO")
	private CbRmbRetranmissRecordDAO cbRmbRetranmissRecordDAO;

	@Override
	@Transactional
	public CbRmbRetranmissRecord saveEntity(CbRmbRetranmissRecord c) {
		return cbRmbRetranmissRecordDAO.save(c);
	}

    @Override
    public List<CbRmbRetranmissRecord> findByGopayOrderId(String gopayOrderId) {
        String hql = "from CbRmbRetranmissRecord where gopayOrderId = :orderId order by createTime ASC";
        Map<String, Object> param = new HashMap<>();
        param.put("orderId", gopayOrderId);
        return cbRmbRetranmissRecordDAO.findByHql(hql, param);
    }

}
